package com.scsj.supermarket.view.fragment.goodssortmodel;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.scsj.supermarket.R;
import com.scsj.supermarket.adapter.GoodsSortAddressAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 商品分类 地址选择
 */

public class AddressFragment extends Fragment {

    private String departmentName = "";

    private ImageView back_iv;
    private RecyclerView recycler_view;
    private GoodsSortAddressAdapter goodsSortAddressAdapter;
    private List<String> data;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_goods_sort_address, null);
        initView(view);
        return view;
    }

    private void initView(View view) {

        back_iv = view.findViewById(R.id.back_iv);
        back_iv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().getSupportFragmentManager().popBackStackImmediate();
            }
        });

        recycler_view = view.findViewById(R.id.recycler_view);
        recycler_view = view.findViewById(R.id.recycler_view);
        recycler_view.setLayoutManager(new LinearLayoutManager(getActivity()));

        data = new ArrayList<>();
        data.add("河南郑州市郑东新区嘉怡东方大厦-北门-中 兴南路与福禄路交叉口西100米");
        data.add("山西太原市迎泽区财大北校家属院2号楼 301");
        data.add("河南郑州市郑东新区商都路与中兴南路交汇 处建正东方中心");
        goodsSortAddressAdapter = new GoodsSortAddressAdapter(data);
        recycler_view.setAdapter(goodsSortAddressAdapter);
    }

}
